package net.mhelvens.deltaprofiles;

import android.net.Uri;
import android.view.View;
import android.view.ViewGroup;

public class LogicalNotCondition extends BaseLogicalCondition {
    @SuppressWarnings("unused") private static final String TAG = LogicalNotCondition.class.getSimpleName();

	public static Uri static_uri() {
		return new Uri.Builder().path(
			LogicalNotCondition.class.getName()
		).build();
	}

	@Override
	protected boolean eval() {
		return ! allSubconditions().valueAt(0).eval();
	}
	
	private View notLabel() {
		return getLabelView(R.string.logical_not, 0, R.dimen.unary_op_padding);
	}
	
	@Override
	public void buildFormula(OnChanged oc, FormulaViewAdapter fva, ViewGroup container) {
		fva.appendView(notLabel());
		
		if (allSubconditions().size() == 0)
			fva.appendView(dropTarget(oc, 0));
		else
			allSubconditions().valueAt(0).buildFormula(oc, fva, container);
	}
	
}
